package com.ruoyi.course.service.impl;

import java.util.List;

import com.ruoyi.course.domain.vo.yearAndtermVo;
import com.ruoyi.course.mapper.AcademicYearMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.course.mapper.AcademicTermMapper;
import com.ruoyi.course.domain.AcademicTerm;
import com.ruoyi.course.service.IAcademicTermService;

/**
 * 学期信息Service业务层处理
 * 
 * @author chenxl
 * @date 2025-08-29
 */
@Service
public class AcademicTermServiceImpl implements IAcademicTermService 
{
    @Autowired
    private AcademicTermMapper academicTermMapper;
    @Autowired
    private AcademicYearMapper academicYearMapper;

    /**
     * 查询学期信息
     * 
     * @param id 学期信息主键
     * @return 学期信息
     */
    @Override
    public AcademicTerm selectAcademicTermById(String id)
    {
        return academicTermMapper.selectAcademicTermById(id);
    }

    /**
     * 查询学期信息列表
     * 
     * @param academicTerm 学期信息
     * @return 学期信息
     */
    @Override
    public List<AcademicTerm> selectAcademicTermList(AcademicTerm academicTerm)
    {
        return academicTermMapper.selectAcademicTermList(academicTerm);
    }

    /**
     * 新增学期信息
     * 
     * @param academicTerm 学期信息
     * @return 结果
     */
    @Override
    public int insertAcademicTerm(AcademicTerm academicTerm)
    {
        return academicTermMapper.insertAcademicTerm(academicTerm);
    }

    /**
     * 修改学期信息
     * 
     * @param academicTerm 学期信息
     * @return 结果
     */
    @Override
    public int updateAcademicTerm(AcademicTerm academicTerm)
    {
        return academicTermMapper.updateAcademicTerm(academicTerm);
    }

    /**
     * 批量删除学期信息
     * 
     * @param ids 需要删除的学期信息主键
     * @return 结果
     */
    @Override
    public int deleteAcademicTermByIds(String[] ids)
    {
        return academicTermMapper.deleteAcademicTermByIds(ids);
    }

    /**
     * 删除学期信息信息
     * 
     * @param id 学期信息主键
     * @return 结果
     */
    @Override
    public int deleteAcademicTermById(String id)
    {
        return academicTermMapper.deleteAcademicTermById(id);
    }

    /*获取当前学年学期的信息详细getCurrentYearAndTerm*/
    @Override
    public yearAndtermVo getCurrentYearAndTerm()
    {
        yearAndtermVo yearAndtermVo = new yearAndtermVo();
        yearAndtermVo.setYear(academicYearMapper.selectAcademicYearByStatus1());
        yearAndtermVo.setTerm(academicTermMapper.selectAcademicTermByStatus1());
        return yearAndtermVo;
    }
}
